<template>
    <div>
  <div class="AllOrder" v-for="(item, index) in OrderAllFormation" :key="index">
    <!-- 全部订单 -->
    <div class="AllOrder-img" >
      <img :src="item.photo" alt="" style="width: 150px; height: 150px; ">
    </div>
    <div class="AllOrder-xiangqing" style="width: 500px;border-right: 2px solid #66cdaa;">
      <!-- {{item.name}} -->
      <br>
      {{item.introduction}}
    </div>
    <div class="AllOrder-address" style="width: 200px; border-right: 2px solid #66cdaa; line-height: 150px;"> 
     {{item.address}}
    </div>
    <div class="AllOrder-money" style="width: 100px; border-right: 2px solid #66cdaa;  line-height: 150px;">
      ¥{{item.price}}
    </div>
    <div class="AllOrder-state" style="width: 100px; border-right: 2px solid #66cdaa; line-height: 150px;">
      <span>待收货</span>
    </div>
    <div style="line-height: 150px;">
    <el-button  style="margin-left: 40px;  background-color: #66cdaa; color: white; line-height: 150px;" @click="remove(index)" >删除</el-button>

    </div>
  </div>
</div>
</template>

<script>
import axios from '@/utils/request';
  import {useUserStore} from '@/stores/user'


export default {
name:'OrderAll',
data(){
  return{
    OrderAllFormation:[]
  }
},
methods: {
  getOrderformation(){
  const user=useUserStore();
    axios.post('/personal/selorders',JSON.stringify(user.userInfo.userinformation.id)).then(res=>{
    console.log(res);
    this.OrderAllFormation=res.data
  })
    },
    remove(index){
      this.OrderAllFormation.splice(index, 1)
      const parmas={
        id:this.OrderAllFormation[index].id
      }
    axios.post('/order/del',JSON.stringify(parmas)).then(res=>{
      if(res.code===200)
      {
        console.log('请求成功');
      }
    })

    }
  },
  mounted(){
    this.getOrderformation();
  }
}
</script>

<style>
.AllOrder{
  display: flex;
  width: 1200px;
  background-color: 	#FFFAFA;
margin-top: 15px;
border: 2px solid #66cdaa;
border-radius: 5px;
}
</style>